# syntax=docker/dockerfile:1

FROM node:16.13.1-alpine3.12 AS build-react-stage
ENV NODE_ENV=production
WORKDIR /app
COPY package.json .
RUN npm install --production
COPY . .
RUN npm run-script build

FROM node:16.13.1-alpine3.12 AS build-server-stage
ENV NODE_ENV=production
WORKDIR /app
RUN npm install -g serve --production
COPY  --from=build-react-stage /app/build ./build
CMD ["serve", "-p", "3000", "-s", "./build"]


